package com.bcbim.smart_water.point.service;

import com.bcbim.common.sys.Code;
import com.bcbim.smart_water.point.mapper.PipelinePointMapper;
import com.bcbim.smart_water_interface.line.VO.ListLineVO;
import com.bcbim.smart_water_interface.pipeManagement.dto.PipePointExcelDownload;
import com.bcbim.smart_water_interface.pipeManagement.vo.PipeLineListAppVO;
import com.bcbim.smart_water_interface.pipeManagement.vo.PipeListCodeVO;
import com.bcbim.smart_water_interface.pipeline.VO.PipelinePointVO;
import com.bcbim.smart_water_interface.point.DO.PipelinePointDO;
import com.bcbim.smart_water_interface.point.DO.PipelinePointQuery;
import com.bcbim.smart_water_interface.point.VO.PipelinePointDataListVO;
import com.bcbim.smart_water_interface.point.VO.PipelinePointDataVO;
import com.bcbim.smart_water_interface.point.service.PipelinePointService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @Description:
 * @Author XueHao
 * @Date 2021/8/9
 * @Version V1.0
 **/
@Service(timeout = 60 * 1000, group = "pipelinePoint", version = "1.0.0")
public class PipelinePointServiceImpl implements PipelinePointService {
    @Autowired
    private PipelinePointMapper pipelinePointMapper;


    /**
     * @return int
     * @Description 新增管点
     * @Author XueHao
     * @Date 2021/8/13
     */
    @Override
    public int insertPipelinePointData(PipelinePointDO pipelinePointDO) {
        return pipelinePointMapper.insertPipelinePointData(pipelinePointDO);
    }

    /**
     * @return List<Code>
     * @Description 道路下拉列表
     * @Author XueHao
     * @Date 2021/8/13
     */
    @Override
    public List<Code> getRolePull() {
        return pipelinePointMapper.getRolePull();
    }

    /**
     * @return List<PipelinePointListDataVO>
     * @Description 查询管点数据列表
     * @Author XueHao
     * @Date 2021/8/13
     */
    @Override
    public List<PipelinePointDataListVO> listPipelinePointData(PipelinePointQuery query) {
        return pipelinePointMapper.listPipelinePointData(query);
    }

    /**
     * @return int
     * @Description 查询管点数据列表条数
     * @Author XueHao
     * @Date 2021/8/13
     */
    @Override
    public int getPipelinePointDataListCount(PipelinePointQuery query) {
        return pipelinePointMapper.getPipelinePointDataListCount(query);
    }

    /**
     * @return PipelinePointDataVO
     * @Description 查询管点数据详情
     * @Author XueHao
     * @Date 2021/8/13
     */
    @Override
    public PipelinePointDataVO getPipelinePointData(String id) {
        return pipelinePointMapper.getPipelinePointData(id);
    }

    /**
     * @return int
     * @Description 删除管点数据
     * @Author XueHao
     * @Date 2021/8/13
     */
    @Override
    public int removePipelinePointData(String id) {
        return pipelinePointMapper.removePipelinePointData(id);
    }

    /**
     * @return int
     * @Description 更新管点数据
     * @Author XueHao
     * @Date 2021/8/13
     */
    @Override
    public int updatePipelinePointData(PipelinePointDO pipelinePointDO) {
        return pipelinePointMapper.updatePipelinePointData(pipelinePointDO);
    }

    /**
     * @return PipelinePointVO
     * @Description 获取管线详情
     * @Author XueHao
     * @Date 2021/8/19
     */
    @Override
    public PipelinePointVO getPipelinePoint(String id) {
        return pipelinePointMapper.getPipelinePoint(id);
    }

    /**
     * 导入excel中的管点数据
     *
     * @param list 管点数据集合
     * @return int
     * @author wxc
     * @date 2021/9/1  10:14
     */
    @Override
    public int insertPointList(List<PipePointExcelDownload> list) {
        return pipelinePointMapper.insertPointList(list);
    }

    /**
     * 获取需要导出的excel的数据通过id列表
     *
     * @param list 管点id集合
     * @return java.util.List<com.bcbim.pipeline_interface.pipeManagement.dto.PipeLineExcelDownload>
     * @author wxc
     * @date 2021/9/1  19:06
     */
    @Override
    public List<PipePointExcelDownload> getExcelPointList(List<String> list) {
        return pipelinePointMapper.getExcelPointList(list);
    }

    /**
     * 搜索管网编号模糊查询管点
     *
     * @param code 管网编号
     * @return java.util.List<com.bcbim.pipeline_interface.pipeManagement.vo.PipeListCodeVO>
     * @author wxc
     * @date 2021/10/14
     */
    @Override
    public List<PipeListCodeVO> getPipelinePointByCode(String code) {
        return pipelinePointMapper.getPipelinePointByCode(code);
    }

    /**
     * 根据起始经度纬度 结束经度纬度 查询所属的管线
     *
     * @param startLat  开始纬度
     * @param startLong 开始经度
     * @param endLat    结束纬度
     * @param endLong   结束经度
     * @return java.util.List<com.bcbim.pipeline_interface.pipeManagement.vo.PipeLineListAppVO>
     * @author wxc
     * @date 2021/10/15
     */
    @Override
    public List<PipeLineListAppVO> listLineByLatLongApp(Double startLat, Double startLong, Double endLat, Double endLong) {
        return pipelinePointMapper.listLineByLatLongApp(startLat, startLong, endLat, endLong);
    }

    /**
     * @Description: 查询管井id
     * @Param: startPoint
     * @Return: String
     * @Author: ye
     * @Date: 2021/11/13
     */
    @Override
    public String getPointIdByCode(String startPoint) {
        return pipelinePointMapper.getPointIdByCode(startPoint);
    }

    @Override
    public List<ListLineVO> getLineByPointId(String id) {
        return pipelinePointMapper.getLineByPointId(id);
    }

    @Override
    public int countLineByPointId(String id) {
        return pipelinePointMapper.countLineByPointId(id);
    }

    @Override
    public boolean checkPointCode(String code) {
        return pipelinePointMapper.checkPointCode(code) > 0;
    }

    @Override
    public void cleanPointCode(String code) {
        pipelinePointMapper.cleanPointCode(code);
    }

    @Override
    public int insertPoint(PipePointExcelDownload pipeLineExcelDownload) {
        return pipelinePointMapper.insertPoint(pipeLineExcelDownload);
    }
}
